<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category   design_default
 * @package    Mage
 * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<div class="entry-edit">
    <?php echo $this->getFormHtml() ?>

    <div class="entry-edit-head">
        <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__("Packages") ?></h4>
    </div>
    <fieldset id="depends_packages_fieldset" class="grid">
        <legend><?php echo $this->__("Packages") ?></legend>
        <table class="data" cellspacing="0">
            <thead>
                <tr class="headings">
                    <th><?php echo $this->__("Package") ?></th>
                    <th><?php echo $this->__("Channel") ?></th>
                    <th><?php echo $this->__("Min") ?></th>
                    <th><?php echo $this->__("Max") ?></th>
                    <th><?php echo $this->__("Recommended") ?></th>
                    <th><?php echo $this->__("Exclude") ?></th>
                    <th><?php echo $this->__("Type") ?></th>
                    <th><?php echo $this->__("Action") ?></th>
                </tr>
                <tr id="depends_packages_template" style="display:none">
<?php function showDependsPackageTemplate($self, $_i=0) { ?>
                    <td style="margin-bottom:5px;">
                        <!--<select name="depends[package][name][]">
                        <?php foreach ($self->getPackages() as $_value=>$_label): ?>
                            <option value="<?php echo $_value ?>" <?php echo $self->getSelected('depends/package/name/'.$_i, $_value) ?>><?php echo $_label ?></option>
                        <?php endforeach ?>
                        </select>-->
                        <input class="input-text" style="width:200px;" name="depends[package][name][]" value="<?php echo $self->getValue('depends/package/name/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <input class="input-text" style="width:200px;" name="depends[package][channel][]" value="<?php echo $self->getValue('depends/package/channel/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <input class="input-text" style="width:50px;" name="depends[package][min][]" value="<?php echo $self->getValue('depends/package/min/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <input class="input-text" style="width:50px;" name="depends[package][max][]" value="<?php echo $self->getValue('depends/package/max/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <input class="input-text" style="width:100px;" name="depends[package][recommended][]" value="<?php echo $self->getValue('depends/package/recommended/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <input class="input-text" style="width:100px;" name="depends[package][exclude][]" value="<?php echo $self->getValue('depends/package/exclude/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <select name="depends[package][type][]" style="width:70px">
                            <?php foreach ($self->getDependTypes() as $_value=>$_label): ?>
                                <option value="<?php echo $_value ?>" <?php echo $self->getSelected('depends/package/type/'.$_i, $_value) ?>><?php echo $_label ?></option>
                            <?php endforeach ?>
                        </select>
                    </td><td style="margin-bottom:5px;">
                        <?php echo $self->getRemoveRowButtonHtml('tr') ?>
                    </td>
<?php } ?>
<?php showDependsPackageTemplate($this) ?>
                </tr>
            </thead>
            <tbody id="depends_packages_container">
            <?php if ($this->getData('depends/package/name')): ?>
            <?php foreach ($this->getData('depends/package/name') as $_i=>$_dbField): ?>
                <?php if (0===$_i) continue; ?>
                <tr>
<?php showDependsPackageTemplate($this, $_i) ?>
                </tr>
            <?php endforeach ?>
            <?php endif ?>
            </tbody>
            <tfoot>
                <tr>
                    <td class="a-right" colspan="8"><?php echo $this->getAddRowButtonHtml('depends_packages_container', 'depends_packages_template', $this->__('Add Package dependency')) ?></td>
                </tr>
            </tfoot>
        </table>
    </fieldset>

    <div class="entry-edit-head">
    <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__("Subpackages") ?></h4>
    </div>
    <fieldset id="depends_subpackages_fieldset" class="grid">
        <legend><?php echo $this->__("Subpackages") ?></legend>
        <table class="data" cellspacing="0">
            <thead>
                <tr class="headings">
                    <th><?php echo $this->__("Subpackage") ?></th>
                    <th><?php echo $this->__("Channel") ?></th>
                    <th><?php echo $this->__("Min") ?></th>
                    <th><?php echo $this->__("Max") ?></th>
                    <th><?php echo $this->__("Recommended") ?></th>
                    <th><?php echo $this->__("Exclude") ?></th>
                    <th><?php echo $this->__("Type") ?></th>
                    <th><?php echo $this->__("Action") ?></th>
                </tr>
                <tr id="depends_subpackages_template" style="display:none">
<?php function showDependsSubpackageTemplate($self, $_i=0) { ?>
                    <td style="margin-bottom:5px;">
                        <input class="input-text" style="width:200px;" name="depends[subpackage][name][]" value="<?php echo $self->getValue('depends/subpackage/name/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <input class="input-text" style="width:200px;" name="depends[subpackage][channel][]" value="<?php echo $self->getValue('depends/subpackage/channel/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <input class="input-text" style="width:50px;" name="depends[subpackage][min][]" value="<?php echo $self->getValue('depends/subpackage/min/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <input class="input-text" style="width:50px;" name="depends[subpackage][max][]" value="<?php echo $self->getValue('depends/subpackage/max/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <input class="input-text" style="width:100px;" name="depends[subpackage][recommended][]" value="<?php echo $self->getValue('depends/subpackage/recommended/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <input class="input-text" style="width:100px;" name="depends[subpackage][exclude][]" value="<?php echo $self->getValue('depends/subpackage/exclude/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <select name="depends[subpackage][type][]" style="width:70px">
                        <?php foreach ($self->getDependTypes() as $_value=>$_label): ?>
                            <option value="<?php echo $_value ?>" <?php echo $self->getSelected('depends/subpackage/type/'.$_i, $_value) ?>><?php echo $_label ?></option>
                        <?php endforeach ?>
                        </select>
                    </td><td style="margin-bottom:5px;">
                        <?php echo $self->getRemoveRowButtonHtml('tr') ?>
                    </td>
<?php } ?>
<?php showDependsSubpackageTemplate($this) ?>
                </tr>
            </thead>
            <tbody id="depends_subpackages_container">
            <?php if ($this->getData('depends/subpackage/name')): ?>
            <?php foreach ($this->getData('depends/subpackage/name') as $_i=>$_dbField): ?>
                <?php if (0===$_i) continue; ?>
                <tr>
<?php showDependsSubpackageTemplate($this, $_i) ?>
                </tr>
            <?php endforeach ?>
            <?php endif ?>
            </tbody>
            <tfoot>
                <tr>
                    <td class="a-right" colspan="8"><?php echo $this->getAddRowButtonHtml('depends_subpackages_container', 'depends_subpackages_template', $this->__('Add Subpackage dependency')) ?></td>
                </tr>
            </tfoot>
        </table>
    </fieldset>

    <div class="entry-edit-head">
    <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__("Extensions") ?></h4>
    </div>
    <fieldset id="depends_extensions_fieldset" class="grid">
        <legend><?php echo $this->__("Extensions") ?></legend>
        <table class="data" cellspacing="0">
            <thead>
                <tr class="headings">
                    <th><?php echo $this->__("Extension") ?></th>
                    <th><?php echo $this->__("Min") ?></th>
                    <th><?php echo $this->__("Max") ?></th>
                    <th><?php echo $this->__("Recommended") ?></th>
                    <th><?php echo $this->__("Exclude") ?></th>
                    <th><?php echo $this->__("Type") ?></th>
                    <th><?php echo $this->__("Action") ?></th>
                </tr>
                <tr id="depends_extensions_template" style="display:none">
<?php function showDependsExtensionsTemplate($self, $_i=0) { ?>
                    <td style="margin-bottom:5px;">
                        <select name="depends[extension][name][]" style="width:100px">
                        <?php foreach ($self->getExtensions() as $_value=>$_label): ?>
                            <option value="<?php echo $_value ?>" <?php echo $self->getSelected('depends/extension/name/'.$_i, $_value) ?>><?php echo $_label ?></option>
                        <?php endforeach ?>
                        </select>
                    </td><td style="margin-bottom:5px;">
                        <input class="input-text" style="width:50px;" name="depends[extension][min][]" value="<?php echo $self->getValue('depends/extension/min/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <input class="input-text" style="width:50px;" name="depends[extension][max][]" value="<?php echo $self->getValue('depends/extension/max/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <input class="input-text" style="width:100px;" name="depends[extension][recommended][]" value="<?php echo $self->getValue('depends/extension/recommended/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <input class="input-text" style="width:100px;" name="depends[extension][exclude][]" value="<?php echo $self->getValue('depends/extension/exclude/'.$_i) ?>"/>
                    </td><td style="margin-bottom:5px;">
                        <select name="depends[extension][type][]" style="width:70px">
                            <?php foreach ($self->getDependTypes() as $_value=>$_label): ?>
                                <option value="<?php echo $_value ?>" <?php echo $self->getSelected('depends/extension/type/'.$_i, $_value) ?>><?php echo $_label ?></option>
                            <?php endforeach ?>
                        </select>
                    </td><td style="margin-bottom:5px;">
                        <?php echo $self->getRemoveRowButtonHtml('tr') ?>
                    </td>
<?php } ?>
<?php showDependsExtensionsTemplate($this) ?>
                </tr>
            </thead>
            <tbody id="depends_extensions_container">
            <?php if ($this->getData('depends/extension/name')): ?>
            <?php foreach ($this->getData('depends/extension/name') as $_i=>$_dbField): ?>
                <?php if (0===$_i) continue; ?>
                <tr>
<?php showDependsExtensionsTemplate($this, $_i) ?>
                </tr>
            <?php endforeach ?>
            <?php endif ?>
            </tbody>
            <tfoot>
                <tr>
                    <td class="a-right" colspan="7"><?php echo $this->getAddRowButtonHtml('depends_extensions_container', 'depends_extensions_template', $this->__('Add PHP Extension dependency')) ?></td>
                </tr>
            </tfoot>
        </table>
    </fieldset>

</div>
